from common import pytdx_proto
from f10 import f10
from f11 import f11
from f12 import f12

ip = ["211.100.23.200:7779", "61.135.173.136:7709", "61.151.252.170:7709", "58.49.110.76:7709", "59.42.252.142:7709",
      "211.100.23.202:7709", "218.75.75.20:7709"]
hq = pytdx_proto.HQ(ip)
hq.setupCodeNameSina()
stock_num = len(hq.code_name)
print("\n{:} stocks on the market today.".format(stock_num))
max_retry = 3
cate_num = hq.setupCategories(max_retry)
if stock_num * 4 * 0.9 > cate_num:
    raise Exception("err in setupCategories stock-{} cate-{}".format(stock_num, cate_num))
# print(len(hq.infoParamMap))

f10.run(hq, max_retry)
f11.run(hq, max_retry)
f12.run(hq, max_retry)
